import 'package:demo/theme/app_colors.dart';
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';

import 'package:get/get.dart';

import '../../../../theme/app_text_theme.dart';
import 'confirm_controller.dart';

class ConfirmView extends GetView<ConfirmController> {
  const ConfirmView({Key? key}) : super(key: key);
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      backgroundColor: Color_bg,
      body:  Stack(
        children: [
          getTopBg(),
          getTopBg1(),
          AppBar(
            backgroundColor: const Color(0x00000000),
            title: Text('申请确认', style: text_title_white),
            iconTheme: const IconThemeData(color: Color_white),
          ),
          Container(
            decoration: BoxDecoration(
                color: Color_white,
                borderRadius: BorderRadius.all(Radius.circular(8.w))
            ),
            margin: EdgeInsets.only(left:15.w,right:15.w,
                top: MediaQuery.of(context).padding.top+AppBar().preferredSize.height + 70.w),
            child: Column(
              mainAxisSize: MainAxisSize.min,
              children: [
                Row(
                  mainAxisAlignment : MainAxisAlignment.spaceBetween,
                  children: [
                    SizedBox(width: 45.w, height: 30.w),
                    Container(
                      width: 120.w,
                        height: 30.w,
                        decoration: const BoxDecoration(
                          image: DecorationImage(image: AssetImage("assets/images/ic_apply_top.png"),
                          fit: BoxFit.fill),
                        ),
                        child: Center(child: Text('借款申请',style: text_131732_16b.copyWith(color: const Color(0xff565CFE))))),
                    Container(
                      width: 45.w,
                      height: 30.w,
                      padding: EdgeInsets.symmetric(horizontal: 15.w,vertical: 5.w),
                      child: InkWell(
                          onTap: () => Get.back(),
                          child: Image.asset('assets/images/ic_close.png',width: 15.w,height: 15.w)))
                ]),
                SizedBox(height: 30.w),
                Text('恭喜您已通过初审',style: text_131732_16b.copyWith(fontSize:32.sp,color: const Color(0xff565CFE))),
                SizedBox(height: 40.w),
                Obx(() => Text(controller.str.value,style: text_131732_16)),
                SizedBox(height: 30.w),
                RawMaterialButton(
                  elevation: 0,
                  fillColor:Color_main,
                  shape : RoundedRectangleBorder(borderRadius : BorderRadius.all(Radius.circular(20.w))),
                  constraints: BoxConstraints.tightFor(width: Get.width - 102.w, height: 40.w),
                  child: Text('立即领钱',style: text_white_16),
                  onPressed: ()=> controller.submit(),
                ),
                SizedBox(height: 30.w),
              ]),
          ),
        ],
      ),
    );
  }

  Widget getTopBg(){
    return Container(
      width: Get.width,
      height: Get.width / 2,
      decoration: const BoxDecoration(
        gradient: LinearGradient(
          begin: Alignment.topCenter,
          end: Alignment.bottomCenter,
          colors: [
            Color_main,
            Color(0xfff2f6ff)
          ],
        ),
      ),
    );
  }
  Widget getTopBg1(){
    return Container(
      width: Get.width,
      height: Get.height,
      color: const Color.fromARGB(51, 0, 0, 0),
    );
  }
}
